<!DOCTYPE html>
<html>

<!-- Mirrored from www.zi-han.net/theme/hplus/table_jqgrid.html by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 20 Jan 2016 14:20:02 GMT -->

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>订单列表</title>

    <link href="css/bootstrap.min14ed.css?v=3.3.6" rel="stylesheet">
    <link href="css/font-awesome.min93e3.css?v=4.4.0" rel="stylesheet">
    <link href="css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
    <link href="css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="css/animate.min.css" rel="stylesheet">
    <link href="css/style.min862f.css?v=4.1.0" rel="stylesheet">
    <link href="css/timePicker.css" rel="stylesheet">
    <link href="css/newStyle.css" rel="stylesheet">
    <link href="js/plugins/fancybox/jquery.fancybox.css" rel="stylesheet">

    <style>
        /* 重写bookstrap样式表 勿删 */
        .form_inputs {
            width: 160px;
            background-color: #ebebeb;
            border: 1px solid #06a3f9;
            border-radius: 20px;
            -webkit-border-radius: 20px;
            -moz-border-radius: 20px;
            -o-border-radius: 20px;
            -ms-border-radius: 20px;
        }

        .ibox-title {
            padding: 20px;
        }

        .mb30 {
            margin-bottom: 20px;
        }

        /* 重写bookstrap样式表 勿删 */
        .ui-jqdialog {
            height: auto !important;
        }

        .ui-common-table tbody {
            background-color: #eaf5fc !important;
        }

        .modal-dialog {
            margin: 80px auto !important;
        }

        .form-group {
            margin-left: 0px !important;
            margin-right: 0px !important;
        }

        .modal-sm {
            width: 600px;
        }

        .col-sm-3 {
            width: 30%;
        }

        .col-sm-8 {
            width: 70%;
        }

        .form-horizontal .control-label {
            text-align: left;
            padding-top: 5px;
            font-size: 18px;
        }

        @media only screen and (min-width: 100px) and (max-width: 600px) {
            .modal-sm {
                width: 400px;
            }

            .col-sm-3 {
                width: 40%;
            }

            .col-sm-8 {
                width: 60%;
            }

            .scroll_div {
                width: 85%;
            }

            .form-horizontal .control-label {
                text-align: left;
                padding-top: 5px;
                font-size: 14px;
            }

            .dialog_btn {
                font-size: 14px !important;
            }
        }

        @media only screen and (min-width: 650px) {
            .modal-sm {
                width: 600px;
            }
        }

        /*以下是等待状态的通用样式*/
        .wating_big_div {
            position: fixed;
            top: 0px;
            width: 100%;
            height: 100%;
            display: table;
            z-index: 9999;
        }

        .zhezhao {
            opacity: 0.3;
            position: absolute;
            top: 0px;
            width: 100%;
            height: 100%;
            z-index: 9999;
        }

        .wating_content_div {
            text-align: center;
            background: none;
            display: table-cell;
            vertical-align: middle;
        }

        /*以上是等待状态的通用样式*/
        .inputcherckStyle {
            width: 18px;
            height: 18px;
            -webkit-appearance: none;
            -moz-appearance: none;
            appearance: none;
            background: url("")
        }

        .inputcherckStyle:hover {
            background: url("")
        }

        .inputcherckStyle:checked {
            background: url("")
        }

        #timebox {
            width: 50%;
            height: 100%;
            /* display: flex;
        align-items: center; */
        }

        #timebox>span {
            width: 4.16%;
            display: block;
            float: left;
        }

        .order_choose {
            padding: 5px 10px;
            font-size: 14px;
            margin-right: 10px;
            margin-top: 8px;
            margin-bottom: 5px;
            border: 1px solid #ccc;
            text-align: center;
            cursor: pointer;
        }
        .nonetext{
            width: 100%;
            height: 40px;
            line-height: 40px;
            text-align: center;
            display: none;
        }
    </style>
</head>

<body class="gray-bg">
    <div class="wrapper wrapper-content  animated fadeInRight">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox ">

                    <div class="ibox-title pull-left w100p" style="padding: 10px 20px;">
                        <div class="pull-left">
                            <div class="ibox-tools cache5">
                                技术服务订单列表
                            </div>
                        </div>

                        <div class="pull-right">
                            <button class="refresh_btn">
                                <a class="refresh_a">
                                    <i class="fa fa-refresh"></i> 刷新
                                </a>
                            </button>
                        </div>
                    </div>


                    <div class="w100p pull-left" style="padding-top:20px;padding-left: 30px;background: #fff;">
                        <div class="pull-left order_choose order_choose_active" data-ordertype="0"> 全部订单
                            (<span class="navTextNum allProduction"></span>)</div>
                        <div class="pull-left order_choose" data-ordertype="1"> 待付款(
                            <span class="navTextNum been"></span>)</div>
                        <div class="pull-left order_choose" data-ordertype="2"> 待评价(
                            <span class="navTextNum noBeen"></span>)</div>
                        <div class="pull-left order_choose" data-ordertype="3"> 已完成(
                            <span class="navTextNum review"></span>)</div>
                        <div class="pull-left order_choose" data-ordertype="4"> 已关闭(
                            <span class="navTextNum noReview"></span>)</div>
                    </div>

                    <div class="ibox-content pull-left w100p jqGrid_wrapper" id="uploadedWrap" data-gridtype="0"
                        style="padding-top: 0px;">

                        <div class="w100p chaxunBorder">
                            <div class="ibox-title w100p"
                                style="height:50px;background-color: rgb(243, 243, 243);padding: 10px 20px;border-top:0px;">
                                <div class="ibox-tools pull-left">
                                    <span class="titleFindIcon pull-left"></span>
                                    <span class="pull-left" style="position: relative;top: 3px;left: 5px;">筛选条件</span>
                                </div>
                                <div class="pull-right">
                                    <button class="opera_btn" id="check_btn">查询</button>
                                </div>
                            </div>

                            <div class="w100p p20" style="display: flex;">
                                <div class="ml30">
                                    <span class="f14 pull-left h30 lh30">订单编号：</span>
                                    <div class="pull-left">
                                        <input type="text" name="orderSerialNumber" placeholder="订单编号" class="form-control h30 w100p ml10"
                                            style="width: 150px;" aria-required="true">
                                    </div>
                                </div>
                                <div class="ml30">
                                    <span class="f14 pull-left h30 lh30">导购员：</span>
                                    <div class="pull-left">
                                        <input type="text" placeholder="导购员昵称/账号" name="goodsNum" class="form-control h30 w100p ml10"
                                            style="width: 150px;" aria-required="true">
                                    </div>
                                </div>
                                <div class="ml30">
                                    <span class="f14 pull-left h30 lh30">商家：</span>
                                    <div class="pull-left">
                                        <input type="text" placeholder="商家名称/账号" name="storeName" class="form-control h30 w100p ml10"
                                            style="width: 150px;" aria-required="true">
                                    </div>
                                </div>
                            </div>

                        </div>

                        <div class="ibox-title pull-left w100p table-head"
                            style="background-color: rgb(243, 243, 243);padding: 10px 20px;border-top:0px;">
                            <div class="pull-left">
                                <div class="ibox-tools" style="">
                                    <span class="titleFontIcon"></span>
                                    <span class="pull-left" style="position: relative;top: 3px;left: 5px;">数据列表</span>
                                </div>
                            </div>
                            <div class="pull-right ml30">
                                <button class="export_btn">导出订单</button>
                            </div>
                            <div class="pull-right ml30">
                                <button class="bulk_shipment">关闭订单</button>
                            </div>
                            <div class="pull-right ml30">
                                <button class="bulk_shipment">删除订单</button>
                            </div>
                        </div>

                        <div class="pull-left w100p">
                            <table class="table table-bordered mb0 ">
                                <thead>
                                    <tr>
                                        <th><input name="Fruit" class="w20 h20 header_checkbox"type="checkbox" value="" /></th>
                                        <th>订单编号</th>
                                        <th>提交时间</th>
                                        <th>商家名称</th>
                                        <th>商家账号</th>
                                        <th>买家名称</th>
                                        <th>买家账号</th>
                                        <th>服务类型</th>
                                        <th>订单状态</th>
                                        <th>操作</th>
                                    </tr>
                                </thead>
                                <tbody id="tbody_list1"></tbody>
                            </table>
                            <div class="nonetext">暂无数据</div>
                        </div>
                        <div class="pull-left tac c0 f14 w100p pre mt10" id="footer_page_div">
                            <div class="">
                                <div class="pull-left">
                                    <div class="ibox-tools">
                                        <a class="refresh_a">
                                            <i class="fa fa-refresh"></i> 刷新
                                        </a>
                                    </div>
                                </div>
                                <span class="under_line cursor_pointer f_last_span">上一页</span>
                                <span class="pl20 f_page_span">1</span>
                                <span class="pl20 under_line cursor_pointer f_next_span">下一页</span>
                                <span class="pl20">共 <span class="f_count_page_span">1</span> 页</span>
                                <div class="disib ml20">
                                    每页显示：
                                    <select class="p0 disib f_page_select">
                                        <option value="" selected="selected">10</option>
                                        <option value="">50</option>
                                        <option value="">30</option>
                                    </select>
                                    条
                                </div>
                            </div>
                            <div class="record_right_div">

                                数据库总数量： <span class="f_counts_span">0</span> 条
                            </div>
                        </div>
                    </div>

                </div>
            </div>
        </div>
    </div>

    <!--新增的弹框-->
    <div class="modal inmodal fade" id="add_dialog" tabindex="-1" role="dialog" aria-hidden="true">
        <div class="modal-dialog modal-sm">
            <div class="modal-content br8">
                <div class="modal-header p10 bdno">
                    <button type="button" class="close" data-dismiss="modal"><span
                            aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                    <span class="modal-title f18">添加分类</span>
                </div>
                <div class="modal-body bg_f p0">
                    <div class="ibox-content p30">
                        <form class="form-horizontal m-t" id="add_form" method="post">
                            <input type="hidden" name="type" class="add_type" value="1" />
                            <div class="form-group ">
                                <label class="col-sm-3 control-label pull-left"><span
                                        style="color: red;">*</span>分类名称</label>
                                <div class="col-sm-8 pull-left">
                                    <input type="text" class="form-control" name="cateName" value="" required=""
                                        aria-required="true">
                                </div>
                            </div>

                            <div class="form-group ">
                                <label class="col-sm-3 control-label pull-left">排序：</label>
                                <div class="col-sm-8 pull-left">
                                    <input type="text" class="form-control" name="sort" value="" required=""
                                        aria-required="true">
                                </div>
                            </div>


                        </form>
                    </div>
                </div>
                <div class="modal-footer bdno tac pt0040">
                    <button type="button" class=" btn-white clear_btn_style dialog_btn" data-dismiss="modal">关闭</button>
                    <button type="button" class=" btn-primary clear_btn_style bdno dialog_btn ml30"
                        id="add_btn">保存</button>

                </div>
            </div>
        </div>
    </div>
    
    <script src="js/jquery-2.1.0.js" type="text/javascript" charset="utf-8"></script>
    <script src="js/bootstrap.min.js?v=3.3.6"></script>
    <script src="js/plugins/peity/jquery.peity.min.js"></script>
    <script src="js/content.min.js?v=1.0.0"></script>
    <script src="js/plugins/layer/laydate/laydate.js"></script>
    <script src="js/plugins/sweetalert/sweetalert.min.js"></script>
    <script src="js/plugins/iCheck/icheck.min.js"></script>
    <script src="js/plugins/fancybox/jquery.fancybox.js"></script>
    <script src="js/common.js" type="text/javascript" charset="utf-8"></script>
    <script src="js/jquery-timepicker.js" type="text/javascript" charset="utf-8"></script>
    <!--ajax上传插件:jquery.form ajaxSubmit-->
    <script src="js/jquery-form.js" type="text/javascript" charset="utf-8"></script>
    <script>
        var tableTimeout, addTimeout, setPowerTime, editManageTimeout, deleteTimeOut, getPowerTime, limits = 10,
            page = 0,
            counts = 0,
            table_title, roleID;
        var maxIndex;
        var urldata;
        var orderType;
        var userMessage;
        var nickname,accountPhone,storeName,goodsName
        var orderSerialNumber,goodsNum,connectPhone,createTime,orderSource
        var sendPayStatus = ''
        function previewImg (tak) {
            console.log(JSON.stringify(tak))
            
        }
        $(document).ready(function () {
            $(".fancybox").fancybox({openEffect:"none",closeEffect:"none"});
            IsTokenSave();
            userMessage = JSON.parse(sessionStorage.getItem("user_message"));
            
            // 页面数据存储k
            urldata = JSON.parse(sessionStorage.getItem("serOrderKey"));
            // console.log('页面数据存储'+sessionStorage.getItem("serOrderKey"))
            sessionStorage.removeItem('serOrderKey')
            if (urldata) {
                page = urldata.page
                limits = urldata.limits
                orderType = urldata.orderType
                orderSerialNumber = urldata.orderSerialNumber
                goodsNum = urldata.goodsNum
                storeName = urldata.storeName
                $("input[name='orderSerialNumber']").val(orderSerialNumber)
                $("input[name='goodsNum']").val(goodsNum) 
                $("input[name='storeName']").val(storeName)
                if (orderType) {
                    $(".order_choose").removeClass("order_choose_active");
                    $(".order_choose[data-ordertype="+orderType+"]").addClass("order_choose_active");
                    if (orderType == 0) {
                        sendPayStatus = 0
                    } else if (orderType == 1) {
                        sendPayStatus = 1
                    } else if (orderType == 2) {
                        sendPayStatus = 2
                    } else if (orderType == 3) {
                        sendPayStatus = 3;
                    } else if (orderType == 4) {
                        sendPayStatus = 4;
                    }
                }
                $(".f_page_span").html(page);
                $(".f_page_select").find("option[text="+limits+"]").attr("selected",true);
            }
            // 页面数据存储j

            $(".refresh_a").click(function () { //刷新按钮
                location.reload();
            });
            $(".i-checks").iCheck({ //check必须有的脚本
                checkboxClass: "icheckbox_square-green",
                radioClass: "iradio_square-green",
            });
            InitTbodyList(page); //初始化列表数据
            getTabData()
            $("#check_btn").click(function () { //查询按钮
                orderSerialNumber = $("input[name='orderSerialNumber']").val()
                goodsNum = $("input[name='goodsNum']").val() 
                storeName = $("input[name='storeName']").val() 
                page = 0; //重置页数
                $(".f_page_span").html(1); //重置页数
                $("#tbody_list1").html('');
                $(".nonetext").hide();
                InitTbodyList(page); //获取列表数据
            });
            
            $(".export_btn").click(function () { //导出
                if (orderSerialNumber) {
                    orderSerialNumber = $("input[name='orderSerialNumber']").val()
                } else {
                    orderSerialNumber = ''
                }
                if (goodsNum) {
                    goodsNum = $("input[name='goodsNum']").val() 
                } else {
                    goodsNum = ''
                }
                if (storeName) {
                    storeName = $("input[name='storeName']").val()
                } else {
                    storeName = ''
                }
               
                var url = urls + common_url.orderlistExcel + '?X-Access-Token=' + userMessage.token + '&orderSerialNumber=' + orderSerialNumber + '&orderStatus=' + sendPayStatus + '&goodsNum=' + goodsNum + '&storeName=' + storeName;
                swal({
                    title: "是否导出当前？",
                    text: "您确定要导出当前所有的数据吗",
                    type: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#DD6B55",
                    confirmButtonText: "是的，我要导出！",
                    cancelButtonText: "让我再考虑一下…",
                    closeOnConfirm: true,
                    closeOnCancel: true
                }, function (isConfirm) {
                    if (isConfirm) {
                        console.log(url)
                        var a = document.createElement('a');
                        a.setAttribute('href', url);
                        a.setAttribute('target', '_blank');
                        a.setAttribute('id', 'startTelMedicine');
                        // 防止反复添加
                        if(document.getElementById('startTelMedicine')) {
                            document.body.removeChild(document.getElementById('startTelMedicine'));
                        }
                        document.body.appendChild(a);
                        a.click();
                        
                    } else {
                        swal("已取消", "您取消了导出操作！", "error");
                    }
                });
            });
            $(".f_page_select").change(function () { //选择一页多少条数据的select
                page = 0; //重置页数
                $(".f_page_span").html(1); //重置页数
                limits = $(".f_page_select option:selected").text(); //设置当前显示数量
                InitTbodyList(page);
            });

            $(".f_last_span").click(function () { //上一页
                if (page < 1) {
                    TipsAlert("这是最前面的数据了");
                    return false;
                }
                page--;
                $(".f_page_span").html(parseInt($(".f_page_span").html()) - 1);
                InitTbodyList(page);
            });
            $(".f_next_span").click(function () { //下一页

                if (page > maxIndex - 2) {
                    TipsAlert("这是最后面的数据了");
                    return false;
                }
                page++;
                $(".f_page_span").html(parseInt($(".f_page_span").html()) + 1);
                InitTbodyList(page);
            });

            $(".order_choose").click(function () { //tab点击
                $(".order_choose").removeClass("order_choose_active");
                $(this).addClass("order_choose_active");
                orderType = parseInt($(this).data("ordertype"));
                if (orderType == 0) {
                    sendPayStatus = 0
                    page = 0; //重置页数
                    $(".f_page_span").html(1); //重置页数
                    $("#tbody_list1").html('');
                    $(".nonetext").hide();
                    InitTbodyList(page);
                } else if (orderType == 1) {
                    sendPayStatus = 1
                    page = 0; //重置页数
                    $(".f_page_span").html(1); //重置页数
                    $("#tbody_list1").html('');
                    $(".nonetext").hide();
                    InitTbodyList(page);
                } else if (orderType == 2) {
                    sendPayStatus = 2
                    page = 0; //重置页数
                    $(".f_page_span").html(1); //重置页数
                    $("#tbody_list1").html('');
                    $(".nonetext").hide();
                    InitTbodyList(page);
                } else if (orderType == 3) {
                    sendPayStatus = 3;
                    page = 0; //重置页数
                    $(".f_page_span").html(1); //重置页数
                    $("#tbody_list1").html('');
                    $(".nonetext").hide();
                    InitTbodyList(page);
                } else if (orderType == 4) {
                    sendPayStatus = 4;
                    page = 0; //重置页数
                    $(".f_page_span").html(1); //重置页数
                    $("#tbody_list1").html('');
                    $(".nonetext").hide();
                    InitTbodyList(page);
                }
            });
        });
        // header tab栏数据
        function getTabData() {
            // 头部 tab
            $.ajax({
                type: 'get',
                url: urls + common_url.technOrderlistTypeTotal,
                async: true,
                timeout: 30000,
                dataType: "json",
                headers: {
                    'X-Access-Token': userMessage.token,
                },
                success: function (req) {
                    CheckLogout(req); //检查是否登陆过期
                    if (req.code == 0) {
                        $('.allProduction').text(req.data.total)
                        // 判断其他状态
                        //  已上架
                        $('.been').text(req.data.wrapper1)
                        $('.noBeen').text(req.data.wrapper2)
                        $('.review').text(req.data.wrapper3)
                        $('.noReview').text(req.data.wrapper4)
                    } else {
                        // 打印后台返回的值
                        TipsAlert("获取数据失败");
                    }

                }
            })
        }
        /**
         * 该方法用于初始化列表
         * @param {Number} startIndex startIndex是数据起始下标
         * */
        function InitTbodyList(startIndex) {
            Showload("正在初始化列表......");
            tableTimeout = setInterval("Timeout(tableTimeout)", 1000);
            $.ajax({
                type: "get",
                url: urls + common_url.technOrderlist,
                async: true,
                timeout: 30000,
                dataType: "json",
                headers: {
                    'X-Access-Token': userMessage.token,
                },
                data: {
                    page: startIndex,
                    limit: limits,
                    orderSerialNumber: orderSerialNumber, // 订单编号
                    orderStatus: sendPayStatus, // 订单支付状态
                    goodsNum: goodsNum, // 商品编号
                    storeName: storeName, // 店铺名称
                },
                success: function (json) {
                    CheckLogout(json); //检查是否登陆过期
                    if (json.code == 0) {
                        
                        var myData = json.data.records;
                        var tableHtml = "";
                        counts = json.data.total;
                        console.log(myData);
                        if (counts == 0) { //显示或隐藏分页
                            $("#footer_page_div").hide();
                            $(".nonetext").show();
                            InitTime(tableTimeout);
                            return
                        } else {
                            $("#footer_page_div").show();
                        }
                        maxIndex = (counts / limits).toCeil(0);
                        $(".f_count_page_span").html(maxIndex); //设置当前共几页  
                        $(".f_counts_span").html(counts);

                        for (var i = 0; i < myData.length; i++) {
                            var pay_type = ''
                            var goods_cate = ''
                            var order_delivery = ''
                            var payStatus = ''
                            var paySpan = ''
                          
                            if (myData[i].goods_cate == 1) {
                                goods_cate = 'APP服务'
                            } else if (myData[i].goods_cate == 2) {
                                goods_cate = '智慧运营'
                            } else if (myData[i].goods_cate == 3) {
                                goods_cate = '营销服务'
                            } else if (myData[i].goods_cate == 4) {
                                goods_cate = '定制开发'
                            } else if (myData[i].goods_cate == 5) {
                                goods_cate = '智能音箱'
                            } else if (myData[i].goods_cate == 6) {
                                goods_cate = '认证服务'
                            } else if (myData[i].goods_cate == 7) {
                                goods_cate = '功能扩展'
                            } else if (myData[i].goods_cate == 8) {
                                goods_cate = '摄影机'
                            }
                           
                            if (myData[i].order_status == 1) {
                                payStatus = '待支付'
                            } else if (myData[i].order_status == 2) {
                                payStatus = '待评价'
                                paySpan = '<span data-id="' + myData[i].order_serial_number + '" class="under_line cursor_pointer delivery_span pl20 c_1ABC9C">订单发货</span>'
                            } else if (myData[i].order_status == 3) {
                                payStatus = '已完成'
                            } else {
                                payStatus = '已关闭'
                            }
                          
                            tableHtml = tableHtml + '<tr>'+
                                '<td><input type="checkbox" name="" data-ostatus="'+myData[i].order_status+'" class="w20 h20 td_checkbox" value="' + myData[i].order_serial_number + '" /></td>' +
                                '<td>' + myData[i]["order_serial_number"] + '</td>' +
                                '<td class="c_1ABC9C">' + myData[i]["create_time"] + '</td>' +
                                '<td>' + myData[i]["store_name"] + '</td>' +
                                '<td>' + myData[i]["link_phone"] + '</td>' +
                                '<td>' + myData[i]["user_name"] + '</td>' +
                                '<td>' + myData[i]["user_phone"] + '</td>' +
                                '<td>' + goods_cate + '</td>' +
                                '<td>' + payStatus + '</td>' +
                                '<td>' +
                                '<span data-id="' + myData[i].order_serial_number + '" class="under_line cursor_pointer look_span pl20 c_1ABC9C">查看订单</span>' +
                                '</td>' +
                                '</tr>';
                        }
                        $("#tbody_list1").html(tableHtml);
                        // 全选  取消全选
                        $(".header_checkbox").change(function () {
                            var thisStatus = $(".header_checkbox").is(':checked');
                            console.log(thisStatus)
                            if(thisStatus) {
                                $("#tbody_list1 input").prop('checked', true)
                            } else {
                                $("#tbody_list1 input").removeAttr("checked");
                            }
                        });

                        $(".td_checkbox").change(function () {
                            var $subs = $("#tbody_list1 input");  
                            $(".header_checkbox").prop("checked" , $subs.length == $subs.filter(":checked").length ? true :false);
                        });


                        DealTable();
                        InitFunc();
                       
                    } else {
                        TipsAlert(json.code);
                    }
                    InitTime(tableTimeout);
                },
                error: function (xml, text, errorThrown) {
                    if (text == "timeout") {
                        TipsAlert("请求超时,请检查网络或着重新打开该页面.");
                    } else {
                        TipsAlert("请求数据失败,请联系后台技术人员");
                    }
                    InitTime(tableTimeout);
                }

            });
        }


        /**
         * 该方法用于初始化操作列里的事件
         * */
        function InitFunc() {
            $(".up_span").each(function () { //上架
                $(this).click(function () {
                    var dataset = $(this).parents("td").siblings("td").eq(0)[0].dataset;
                    Showload("正在请求上架，请稍后....");
                    deleteTimeOut = setInterval("Timeout(deleteTimeOut)", 1000);
                    $.ajax({
                        type: "post",
                        url: urls + common_url.upperBatch,
                        async: true,
                        timeout: 30000,
                        dataType: "json",
                        headers: {
                            'X-Access-Token': userMessage.token,
                        },
                        data: {
                            id: dataset.id
                        },
                        success: function (json) {
                            CheckLogout(json);
                            if (json.code == 0) {
                                swal({
                                    title: "上架成功",
                                    text: "上架成功",
                                    type: "success",
                                }, function () {
                                    location.reload();
                                });
                            }
                            InitTime(deleteTimeOut);
                        },
                        error: function (xml, text, e) {
                            if (text == "timeout") {
                                TipsAlert("请求超时,请检查网络或着重新操作");
                            } else {
                                TipsAlert("请求数据失败,请联系后台技术人员");
                            }
                            InitTime(deleteTimeOut);
                        }
                    });
                });
               
            });
            $(".down_span").each(function () { //下架
                $(this).click(function () {
                    var dataset = $(this).parents("td").siblings("td").eq(0)[0].dataset;
                    Showload("正在请求下架，请稍后....");
                    deleteTimeOut = setInterval("Timeout(deleteTimeOut)", 1000);
                    $.ajax({
                        type: "post",
                        url: urls + common_url.lowerBatch,
                        async: true,
                        timeout: 30000,
                        dataType: "json",
                        headers: {
                            'X-Access-Token': userMessage.token,
                        },
                        data: {
                            id: dataset.id
                        },
                        success: function (json) {
                            CheckLogout(json);
                            if (json.code == 0) {
                                swal({
                                    title: "下架成功",
                                    text: "下架成功",
                                    type: "success",
                                }, function () {
                                    location.reload();
                                });
                            }
                            InitTime(deleteTimeOut);
                        },
                        error: function (xml, text, e) {
                            if (text == "timeout") {
                                TipsAlert("请求超时,请检查网络或着重新操作");
                            } else {
                                TipsAlert("请求数据失败,请联系后台技术人员");
                            }
                            InitTime(deleteTimeOut);
                        }
                    });
                });
            });

            $(".look_span").each(function () { //订单详情
                $(this).click(function () {
                    var returnValue = {}
                    returnValue.page = page
                    returnValue.limits = limits
                    returnValue.orderType = orderType
                    returnValue.orderSerialNumber = orderSerialNumber
                    returnValue.goodsNum = goodsNum
                    returnValue.storeName = storeName
                    sessionStorage.setItem("serOrderKey",JSON.stringify(returnValue));

                    var dataset = $(this).attr("data-id");
                    window.location.href='./service_orderDetail.html?id='+dataset
                });
            });
           
            $(".delete_span").each(function () { //删除按钮
                $(this).click(function () {
                    var dataset = $(this).parents("td").siblings("td").eq(0)[0].dataset;
                    console.log(JSON.parse(sessionStorage.getItem("user_message")));
                    var userMessage = JSON.parse(sessionStorage.getItem("user_message"));
                    console.log(userMessage.token);
                    swal({
                        title: "请再次确认是否删除？",
                        text: "删除后将无法恢复，请谨慎操作！",
                        type: "warning",
                        showCancelButton: true,
                        confirmButtonColor: "#DD6B55",
                        confirmButtonText: "是的，确定删除",
                        cancelButtonText: "让我再考虑一下…",
                        closeOnConfirm: false,
                        closeOnCancel: true
                    }, function (yes) {
                        if (yes) {
                            Showload("正在请求删除，请稍后....");
                            deleteTimeOut = setInterval("Timeout(deleteTimeOut)", 1000);
                            $.ajax({
                                type: "post",
                                url: urls + common_url.bsysGoodsCate_delete,
                                async: true,
                                timeout: 30000,
                                dataType: "json",
                                headers: {
                                    'X-Access-Token': userMessage.token,
                                },
                                data: {
                                    id: dataset.id
                                },
                                success: function (json) {
                                    console.log(json);
                                    CheckLogout(json);
                                    if (json.code == 0) {
                                        swal({
                                            title: "删除成功",
                                            text: "删除成功",
                                            type: "success",
                                        }, function () {
                                            location.reload();
                                        });
                                    }
                                    InitTime(deleteTimeOut);
                                },
                                error: function (xml, text, e) {
                                    if (text == "timeout") {
                                        TipsAlert("请求超时,请检查网络或着重新操作");
                                    } else {
                                        TipsAlert("请求数据失败,请联系后台技术人员");
                                    }
                                    InitTime(deleteTimeOut);
                                }
                            });
                        }
                    });

                });
            }); //编辑按钮结束括号

        }
    </script>
</body>

</html>